<@_sysSite id=siteId><#assign a=object/></@_sysSite>
<div class="pageFormContent" layoutH="50">
    <dl class="nowrap">
        <dt><@t.page 'site'/>:</dt>
        <dd>
            ${(a.name)!}
            <span class="info"><@t.page 'server_config.nginx_description'/></span>
        </dd>
    </dl>
    <dl class="nowrap">
        <dt><@t.page 'server_config.nginx'/>:</dt>
        <dd>
            <textarea name="description" class="code" mode="nginx"><@_disk>
<#assign
    rootPath=rootPath?replace('\\','/')
    dynamicPath=a.dynamicPath?keep_after('//')?keep_before('/')?keep_before(':')
    dynamicLocation=a.dynamicPath?keep_after('//')?keep_after('/')
    dynamicPort=a.dynamicPath?keep_after('//')?keep_before('/')?keep_after(':')
    sitePath=a.sitePath?keep_after('//')?keep_before('/')?keep_before(':')
    siteLocation=a.sitePath?keep_after('//')?keep_after('/')
    sitePort=a.sitePath?keep_after('//')?keep_before('/')?keep_after(':')
/>
<#if dynamicPath!=sitePath||dynamicPort!=sitePort||dynamicPath=sitePath&&dynamicLocation!=siteLocation||a.useSsi>
    <@_sysDomainList advanced=true siteId=siteId>
#${a.name} <@t.page 'server_config.site'/>
server {
    listen       ${dynamicPort?has_content?then(dynamicPort,80)};
    server_name  ${dynamicPath} <#list page.list as d><#if d.name!=dynamicPath>${d.name}</#if><#if d.wild> *.${d.name}</#if><#sep> </#list>;
        <#if a.useSsi>
    ssi on;
    ssi_silent_errors on;
        </#if>
    location ${dynamicLocation?has_content?then('/'+dynamicLocation,'/')} {
        proxy_redirect off;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_connect_timeout 5;
        proxy_send_timeout 30;
        proxy_read_timeout 10;
        proxy_pass http://cms;
        
        #<@t.page 'server_config.proxy'/>
        #proxy_pass http://cms/publiccms/;
        #proxy_cookie_path /publiccms/ /;
    }

    location ${dynamicLocation?has_content?then('/'+dynamicLocation,'/')}webfile/ {
        alias   ${rootPath}/web/site_${siteId}/webfile/;
        index  index.html;
    }
        <#if a.useSsi>
    location /include/ {
        alias ${rootPath}/web/site_${siteId}/include/;
    }
        </#if>
        <#if dynamicPath=sitePath&&dynamicLocation!=siteLocation>
    #${a.name} <@t.page 'server_config.static'/>
    location ${siteLocation?has_content?then('/'+siteLocation,'/')} {
        alias   ${rootPath}/web/site_${siteId}/;
        index  index.html;
    }
        </#if>
}
    </@_sysDomainList>
</#if>
<#if dynamicPath!=sitePath||dynamicPort!=sitePort||!(dynamicPath=sitePath&&dynamicLocation!=siteLocation)>
#${a.name} <@t.page 'server_config.static'/>
server {
    listen       ${sitePort?has_content?then(sitePort,80)}; #<@t.page 'server_config.port'/>
    server_name  ${sitePath};
    <#if a.useSsi>
    ssi on;
    ssi_silent_errors on;
    ssi_types text/shtml;

        <#if siteLocation?has_content>
    location /include/ {
        alias ${rootPath}/web/site_${siteId}/include/;
    }
        </#if>
    </#if>

    location ${siteLocation?has_content?then('/'+siteLocation,'/')} {
        alias   ${rootPath}/web/site_${siteId}/;
        index  index.html;
        add_header Access-Control-Allow-Origin *;
    }
}
</#if></@_disk></textarea>
            <span class="info"><@t.page 'server_config.nginx_config_description'/></span>
        </dd>
    </dl>
    <dl class="nowrap">
        <dt><@t.page 'server_config.nginx_common'/>:</dt>
        <dd><textarea name="description" class="code" mode="nginx">
upstream cms {
    #<@t.page 'server_config.upstream'/>
    server localhost:8080  weight=1;
}</textarea>
            <span class="info"><@t.page 'server_config.nginx_common_description'/></span>
        </dd>
    </dl>
</div>
<div class="formBar">
    <ul>
        <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
    </ul>
</div>